﻿//-----------------------------------------------------------------------
// <copyright company="Microsoft Corporation">
//     Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Microsoft.DevDiv.Wpf.Samples
{
    using System.Collections.Generic;

    public class LiveSearchResult
    {
        public IEnumerable<LiveSearchError> Errors
        {
            get
            {
                return this.errors =
                    (this.errors ?? this.inner.GetCollection<LiveSearchError>("./api:Errors/api:Error", LiveSearchError.Create));
            }
        }

        public LiveSearchImageResponse Image
        {
            get
            {
                return this.image =
                    this.image ?? this.inner.GetObject<LiveSearchImageResponse>("./mms:Image", LiveSearchImageResponse.Create);
            }
        }

        internal static LiveSearchResult Create(LiveSearchXmlObject inner)
        {
            return new LiveSearchResult()
            {
                inner = inner
            };
        }

        private IEnumerable<LiveSearchError> errors;
        private LiveSearchImageResponse image;
        private LiveSearchXmlObject inner;
    }
}